
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>后台管理 - 易买网</title>
    <link type="text/css" rel="stylesheet" href="../css/style.css" />
    <script type="text/javascript" src="../scripts/function-manage.js"></script>
	 <link type="text/css" rel="stylesheet" href="../css/style.css" />
    <link type="text/css" rel="stylesheet" href="../css/jquery.pagination.css"/>
    <script type="text/javascript" src="../scripts/function-manage.js"></script>
    <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../js/jquery.pagination.min.js"></script>
    <style type="text/css">
        .box1 {
            width: 600px;
            margin: 0px auto 0;
            height: 34px;
        }

        .page {
            width: 550px;
        }

        .fl {
            float: left;
        }
    </style>
</head>
<body>
<div id="header" class="wrap">
    <div id="logo"><img src="../images/logo.gif" /></div>
    <div class="help"><a href="../index.html">返回前台页面</a></div>
    <div class="navbar">
        <ul class="clearfix">
            <li><a href="index.html">首页</a></li>
            <li><a href="user.html">用户</a></li>
            <li><a href="product.html">商品</a></li>
            <li><a href="order.html">订单</a></li>
            <li class="current"><a href="guestbook.html">留言</a></li>
            <li><a href="news.html">新闻</a></li>
        </ul>
    </div>
</div>
<div id="childNav">
    <div class="welcome wrap">
        管理员pillys您好，今天是2012-12-21，欢迎回到管理后台。
    </div>
</div>
<div id="position" class="wrap">
    您现在的位置：<a href="index.html">易买网</a> &gt; 管理后台
</div>
<div id="main" class="wrap">
    <div id="menu-mng" class="lefter">
        <div class="box">
            <dl>
                <dt>用户管理</dt>
                <dd><em><a href="user-add.html">新增</a></em><a href="user.html">用户管理</a></dd>
                <dt>商品信息</dt>
                <dd><em><a href="manage/productClass-add.jsp">新增</a></em><a href="../ShowFatherTypeServlet">分类管理</a></dd>
                <dd><em><a href="product-add.html">新增</a></em><a href="product.html">商品管理</a></dd>
                <dt>订单管理</dt>
                <dd><a href="order.html">订单管理</a></dd>
                <dt>留言管理</dt>
                <dd><a href="guestbook.html">留言管理</a></dd>
                <dt>新闻管理</dt>
                <dd><em><a href="./news-add.jsp">新增</a></em><a href="news.html">新闻管理</a></dd>
            </dl>
        </div>
    </div>
    <div class="main">
        <h2>留言管理</h2>
        <div class="manage">
            <table class="list">
                <tr>
                    <th>ID</th>
                    <th>姓名</th>
                    <th>留言内容</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </table>
               <div class="box1">
                <div id="pagination2" class="page fl"></div>
            </div>
        </div>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div id="footer">
    Copyright &copy; 2018 项目一组 All Rights Reserved. 京ICP证1000001号
</div>
</body>
</html>
<script type="text/javascript">
    var pageNo;
    var totalPages;
    var $getTopic=function(){}
    $(function () {

        $getTopic=function (curr) {
            $.ajax({
                type:"POST",
                url:"../GetAllTopicServlet",
                data:{
                    pageNo:curr||1
                },
                dataType:"JSON",
                success:function (data) {
                    pageNo=data.pageNo;
                    totalPages=data.totalPage;
                    $("#topictable").find(".addTr").remove();
                    $.each(data.items,function (index,obj) {
                        var status=obj.status;
                        var result;
                        if(status=="0"){
                            result="未回复";
                        }
                        if(status=="1"){
                            result="已回复"
                        }
                        var newTrList="<tr class='addTr'><td class='first w4 c'>"+obj.tid+"</td><td class='w1 c'>"+obj.user.name+"</td><td>"+obj.context+"</td><td class='w1 c'>"+result+"</td><td><a href='../GetTopicByTidServlet?tid="+obj.tid+"'>回复</a> <a href='../DeleteTopicByTidServlet?tid="+obj.tid+"'onclick='return deleteTid();'>删除</a></td></tr>";
                        $("#topictable").append(newTrList);
                    });
                    $("#pagination2").pagination({
                        currentPage: curr,
                        totalPage:totalPages,
                        isShow: false,
                        count: 5,
                        prevPageText: "<上一页",
                        nextPageText: "下一页>",
                        callback: function(current) {
                            $("#current2").text(current);
                            $getTopic(current);
                        }
                    });
                }
            });
        }
        $getTopic();
    });
    function deleteTid() {
        var flag=confirm("你确定要删除吗?");
        if(flag==true){
            return true;
            alert(flag);
        }
        if(flag==false){
            return false;
            alert(flag);
        }
    }
</script>
